const { Rule, LinValidator } = require('../../core/lin-validator-v2')

class userRegisterValidator extends LinValidator {
    constructor() {
        super()
        this.username = [
            new Rule('isLength', '昵称不符合长度规范', {
                min: 4,
                max: 32
            })
        ]
        this.password = [
            new Rule('isLength', '密码至少6个字符，最多32个字符', {
              min: 6,
              max: 20
            }),
            // 密码至少包含 数字和英文，长度6-20
            new Rule('matches', '密码不符合规范，最少6位，包括至少1个大写字母，1个小写字母，1个数字，1个特殊字符', "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$")
        ]
    }
}

module.exports = {
    userRegisterValidator
}
